<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button onclick="myFunc()">Show</button>
    <p id="result"></p>
    <script>
        function myFunc() {
            var nums1 = [1, 5, 20, 14];
            var nums2 = nums1.map(twice);
            document.getElementById("result").innerHTML = nums2;
        }

        function twice(element) {
            return (element * 2);
        }
    </script>
</body>

</html>